package com.sample.springbatch.job.sample.writer;

import org.springframework.batch.item.database.JpaItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;

/**
 * JpaItemWriter实现类
 * Created by zwg on 2017/8/8.
 */
@Component
public class HbBillLoanDetailJpaItemWriter<HbBillLoanDetail> extends JpaItemWriter {

    @Autowired
    public EntityManagerFactory entityManagerFactory;

    public HbBillLoanDetailJpaItemWriter() {

    }

    @PostConstruct
    public void init(){
        //不能在构造方法中使用 注解加载的属性
        setEntityManagerFactory(entityManagerFactory);
    }


}
